<?php

namespace App\Api\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class DistrictResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            // 'data_id' => $this->data_id,
            'name' => $this['district_info_di_name'],
            'code' => $this['district_info_di_id'],
            'children' => DistrictResource::collection($this['child'])
        ];
    }
}
